﻿using Core.Domain;
using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Repositories
{
    public class AppIdentityDbContext : IdentityDbContext<AppUser, Role, string, IdentityUserLogin, IdentityUserRole, IdentityUserClaim>
    {
        public AppIdentityDbContext()
            : base("IdentityConnection")
        {
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            modelBuilder.Entity<AppUser>().ToTable("lite.Users");
            modelBuilder.Entity<Role>().ToTable("lite.Roles");
            modelBuilder.Entity<IdentityUserRole>().ToTable("lite.UserRoles");
            modelBuilder.Entity<IdentityUserLogin>().ToTable("lite.UserLogins");
            modelBuilder.Entity<IdentityUserClaim>().ToTable("lite.UserClaims");                                
        }

        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
        }
    }
}
